﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Cotizav.PRESENTACION.Base
{
    public partial class ColumnFilter : Form
    {
        string nombreColumna;
        Dictionary<string, string> columnas;

        public string NombreColumna
        {
            get { return nombreColumna; }
            set { nombreColumna = value; }
        }

        public ColumnFilter()
        {
            InitializeComponent();
        }

        public ColumnFilter(Dictionary<string,string> lista) : this()
        {
            columnas = new Dictionary<string, string>();
            columnas = lista;
        }

        private void ColumnFilter_Load(object sender, EventArgs e)
        {
            if (columnas.Count > 0)
            {
                cmbColumna.DataSource = columnas.Values.ToList();
            }
        }

        private void btnAplicar_Click(object sender, EventArgs e)
        {
            if (cmbColumna.SelectedIndex >= 0)
            {
                nombreColumna = columnas.SingleOrDefault(x => x.Value == cmbColumna.SelectedItem.ToString()).Key;
            }
        }
    }
}
